package com.getguang.superstore.cell

import android.content.res.ColorStateList
import android.graphics.Color
import android.view.ViewGroup
import androidx.core.view.setMargins
import androidx.core.view.updateLayoutParams
import com.getguang.superstore.R
import com.getguang.superstore.databinding.CellDealsItemBinding
import com.starblink.android.basic.ext.color
import com.starblink.android.basic.ext.drawable

/**
 * 搜索白底样式
 **/
fun CellDealsItemBinding.toLightMode() {
    bgMain.setImageResource(R.drawable.bg_deals_cell_bg1_light)

    tvStoreName.setTextColor(root.color(R.color.deals_text1))
    tvStoreName.setCompoundDrawablesWithIntrinsicBounds(
        root.drawable(R.drawable.deals_ic_svg_store_light),
        null,
        null,
        null
    )

    btn.backgroundTintList = ColorStateList.valueOf(root.color(R.color.deals_text1))
    btn.setTextColor(Color.WHITE)

    tvViews.compoundDrawables[0].setTint(root.color(R.color.deals_text2))
    tvViews.setTextColor(root.color(R.color.deals_text2))
    tvViews.setBackgroundResource(R.drawable.bg_deals_cell_viewing2)

    tvCodeLabel.updateLayoutParams<ViewGroup.MarginLayoutParams> {
        setMargins(0)
    }
    tvCodeLabel.setBackgroundResource(R.drawable.bg_deals_cell_code2)
    tvCodeLabel.setTextColor(root.color(R.color.deals_text1))
    tvCode.setTextColor(root.color(R.color.deals_text2))
    layoutCode.setBackgroundResource(R.drawable.bg_deals_cell_code_layout)


}